package com.zhht.checkcop.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhbc.framework.dao.IBaseDao;
import com.zhbc.framework.service.ABaseServiceImpl;
import com.zhht.checkcop.check.vo.NovelVO;
import com.zhht.checkcop.dao.NovelDao;
import com.zhht.checkcop.service.NovelService;

@Transactional
@Service("novelService")
public class NovelServiceImpl extends ABaseServiceImpl<NovelVO> implements NovelService{
	@Autowired
	private NovelDao novelDao;
	
	
	protected IBaseDao<NovelVO> getBaseDao() {
		return novelDao;
	}

	@Override
	public List<NovelVO> getListByName(String novelName,int pageNum, int pageSize) throws Exception {
		List<NovelVO> list = novelDao.getListByName(novelName);
		return list;
	}

	@Override
	public PageInfo<NovelVO> getListByClassify(String classifyId, int pageNum,
			int pageSize) throws Exception {
		PageHelper.startPage(pageNum, pageSize);
		Map<String,Object> selectMap=new HashMap<String,Object>();
		selectMap.put("classify_id", classifyId);
		List<NovelVO> list = novelDao.selectList(selectMap);
		return new PageInfo<NovelVO>(list);
	}

	@Override
	public NovelVO getNovelVOById(String novelId) throws Exception {
		return novelDao.selectByPrimaryKey(novelId);
	}
	
}
